package main

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	"gosecond/ch16grpc/grpclearn/proto"
)

func main()  {
	//50051是python服务端的端口，8088是go的服务端端口
	conn, err := grpc.Dial("127.0.0.1:50051", grpc.WithInsecure())
	if err!=nil{
		panic("连接失败")
	}
	defer conn.Close()

	//创建客户端
	c := proto.NewGreeterClient(conn)
	r,err:=c.SayHello(context.Background(), &proto.HelloRequest{Name:"World"})
	if err!=nil{
		panic(err)
	}
	fmt.Println(r.Message)
}
